/*     */ package com.umeng.newxp.view;
/*     */ 
/*     */ import android.app.Activity;
/*     */ import android.content.Context;
/*     */ import android.content.Intent;
/*     */ import android.content.res.Resources;
/*     */ import android.os.Bundle;
/*     */ import android.os.Environment;
/*     */ import android.text.TextUtils;
/*     */ import android.view.View;
/*     */ import android.view.ViewGroup;
/*     */ import android.view.Window;
/*     */ import android.webkit.WebSettings;
/*     */ import android.webkit.WebView;
/*     */ import android.widget.ImageView;
/*     */ import android.widget.ProgressBar;
/*     */ import com.umeng.common.Log;
/*     */ import com.umeng.common.b;
/*     */ import com.umeng.newxp.common.ExchangeConstants;
/*     */ import com.umeng.newxp.common.g;
/*     */ import com.umeng.newxp.controller.ExchangeDataService;
/*     */ import java.io.File;
/*     */ import java.lang.reflect.InvocationTargetException;
/*     */ import java.lang.reflect.Method;
/*     */ 
/*     */ public class aN extends Activity
/*     */ {
/*  45 */   private static final String c = aN.class.getName();
/*     */   public static final String a = "url_key";
/*     */   public static final String b = "configs";
/*     */   private static ExchangeDataService d;
/*     */   private WebView e;
/*     */   private ImageView f;
/*     */   private ImageView g;
/*     */   private ImageView h;
/*     */   private ImageView i;
/*     */   private ViewGroup j;
/*     */   private ViewGroup k;
/*     */   private ProgressBar l;
/*     */   private Context m;
/*     */   private View n;
/*     */   private String o;
/*     */   private aW p;
/*     */   private int q;
/*     */   private int r;
/*     */   private int s;
/*     */   private int t;
/*     */   private int u;
/*     */   private int v;
/*     */   private int w;
/*     */   private int x;
/*     */   private int y;
/*     */   private int z;
/*     */   private int A;
/*     */   private int B;
/*     */   private int C;
/*     */   private int D;
/*     */ 
/*     */   public static void a(Context paramContext, ExchangeDataService paramExchangeDataService, aW paramaW)
/*     */   {
/*  66 */     Intent localIntent = new Intent(paramContext, aN.class);
/*  67 */     aW localaW = paramaW == null ? new aW() : 
/*  68 */       paramaW;
/*  69 */     localIntent.putExtra("configs", localaW);
/*  70 */     d = paramExchangeDataService;
/*     */ 
/*  72 */     StringBuilder localStringBuilder = new StringBuilder("http://ex.mobmore.com/api/wap?")
/*  73 */       .append("sdk_version=" + 
/*  74 */       b.d(paramContext));
/*  75 */     if (!TextUtils.isEmpty(paramExchangeDataService.slot_id))
/*  76 */       localStringBuilder.append("&slot_id=" + paramExchangeDataService.slot_id);
/*     */     else
/*  78 */       return;
/*  79 */     if (!TextUtils.isEmpty(g.a(paramContext, paramExchangeDataService))) {
/*  80 */       localStringBuilder.append("&app_key=" + 
/*  81 */         g.a(paramContext, paramExchangeDataService));
/*     */     }
/*  83 */     if (!TextUtils.isEmpty(localStringBuilder.toString()))
/*  84 */       localIntent.putExtra("url_key", localStringBuilder.toString());
/*  85 */     paramContext.startActivity(localIntent);
/*     */   }
/*     */ 
/*     */   protected void onCreate(Bundle paramBundle)
/*     */   {
/*  90 */     this.p = ((aW)getIntent().getParcelableExtra("configs"));
/*  91 */     if (!this.p.d)
/*  92 */       setTheme(16973829);
/*  93 */     super.onCreate(paramBundle);
/*  94 */     this.m = this;
/*     */ 
/*  96 */     switch (this.p.e) {
/*     */     case 2:
/*  98 */       setRequestedOrientation(0);
/*  99 */       break;
/*     */     case 1:
/* 101 */       setRequestedOrientation(1);
/* 102 */       break;
/*     */     case 3:
/* 104 */       break;
/*     */     case 0:
/*     */     }
/*     */ 
/* 109 */     if (ExchangeConstants.full_screen) {
/* 110 */       requestWindowFeature(1);
/* 111 */       getWindow().setFlags(1024, 
/* 112 */         1024);
/*     */     }
/* 114 */     c();
/* 115 */     setContentView(this.q);
/* 116 */     d();
/*     */ 
/* 118 */     e();
/*     */ 
/* 120 */     this.o = getIntent().getStringExtra("url_key");
/* 121 */     if (!TextUtils.isEmpty(this.o)) {
/* 122 */       this.e.loadUrl(this.o);
/*     */     }
/*     */     else
/* 125 */       b();
/*     */   }
/*     */ 
/*     */   private void b() {
/* 129 */     if (d == null)
/* 130 */       return;
/* 131 */     aO localaO = new aO(this);
/*     */ 
/* 143 */     d.requestDataAsyn(this.m, localaO);
/*     */   }
/*     */ 
/*     */   private void c() {
/* 147 */     this.q = g.a(this.m, 
/* 148 */       "layout", "umeng_xp_clould_dialog");
/* 149 */     this.w = g.a(this.m, 
/* 150 */       "id", "umeng_xp_loading_view");
/* 151 */     this.v = g.a(this.m, 
/* 152 */       "id", "webView");
/* 153 */     this.r = g.a(this.m, 
/* 154 */       "id", "umeng_xp_cancel");
/* 155 */     this.u = g.a(this.m, 
/* 156 */       "id", "umeng_xp_reflesh");
/* 157 */     this.s = g.a(this.m, 
/* 158 */       "id", "umeng_xp_pre");
/* 159 */     this.t = g.a(this.m, 
/* 160 */       "id", "umeng_xp_next");
/* 161 */     this.B = g.a(this.m, 
/* 162 */       "id", "umeng_xp_web_main");
/* 163 */     this.C = g.a(this.m, 
/* 164 */       "id", "umeng_xp_loading_progress");
/* 165 */     this.D = g.a(this.m, 
/* 166 */       "id", "umeng_xp_actionBar");
/*     */ 
/* 168 */     this.x = g.a(this.m, 
/* 169 */       "drawable", "umeng_xp_pre");
/* 170 */     this.y = g.a(this.m, 
/* 171 */       "drawable", "umeng_xp_pre_no");
/* 172 */     this.z = g.a(this.m, 
/* 173 */       "drawable", "umeng_xp_next");
/* 174 */     this.A = g.a(this.m, 
/* 175 */       "drawable", "umeng_xp_next_no");
/*     */   }
/*     */ 
/*     */   private void d() {
/* 179 */     setContentView(this.q);
/* 180 */     this.k = ((ViewGroup)findViewById(this.w));
/* 181 */     this.e = ((WebView)findViewById(this.v));
/* 182 */     this.j = ((ViewGroup)findViewById(this.B));
/* 183 */     this.l = ((ProgressBar)findViewById(this.C));
/*     */ 
/* 185 */     this.j.setVisibility(0);
/* 186 */     this.n = findViewById(this.D);
/* 187 */     if (!this.p.a) {
/* 188 */       this.n.setVisibility(8);
/*     */     }
/* 190 */     if (this.p.a) {
/* 191 */       this.f = ((ImageView)findViewById(this.r));
/* 192 */       this.f.setOnClickListener(new aP(this));
/*     */ 
/* 198 */       this.i = ((ImageView)findViewById(this.u));
/* 199 */       this.i.setOnClickListener(new aQ(this));
/*     */ 
/* 205 */       this.g = ((ImageView)findViewById(this.s));
/* 206 */       this.g.setOnClickListener(new aR(this));
/*     */ 
/* 214 */       this.h = ((ImageView)findViewById(this.t));
/* 215 */       this.h.setOnClickListener(new aS(this));
/*     */     }
/*     */   }
/*     */ 
/*     */   private void e()
/*     */   {
/* 228 */     this.e.setScrollBarStyle(0);
/*     */ 
/* 230 */     WebSettings localWebSettings = this.e.getSettings();
/* 231 */     localWebSettings.setCacheMode(1);
/* 232 */     a(localWebSettings);
/*     */ 
/* 234 */     localWebSettings.setJavaScriptEnabled(true);
/*     */ 
/* 236 */     this.e.setWebChromeClient(new aT(this));
/*     */ 
/* 244 */     this.e.setWebViewClient(new aU(this));
/*     */ 
/* 273 */     this.e.setDownloadListener(new aV(this));
/*     */   }
/*     */ 
/*     */   private void a(WebSettings paramWebSettings)
/*     */   {
/*     */     try
/*     */     {
/* 296 */       Method localMethod1 = WebSettings.class.getMethod(
/* 297 */         "setAppCacheEnabled", new Class[] { Boolean.TYPE });
/* 298 */       localMethod1.invoke(paramWebSettings, new Object[] { Boolean.valueOf(true) });
/*     */ 
/* 300 */       Method localMethod2 = WebSettings.class.getMethod(
/* 301 */         "setAppCachePath", new Class[] { String.class });
/* 302 */       String str = null;
/* 303 */       if (b.b())
/* 304 */         str = Environment.getExternalStorageDirectory()
/* 305 */           .getAbsolutePath() + ExchangeConstants.WEB_CACHE_NAME;
/*     */       else
/* 307 */         str = this.m.getCacheDir().getAbsolutePath() + 
/* 308 */           ExchangeConstants.WEB_CACHE_NAME;
/* 309 */       File localFile = new File(str);
/* 310 */       if (!localFile.exists())
/* 311 */         localFile.mkdirs();
/* 312 */       localMethod2.invoke(paramWebSettings, new Object[] { str });
/*     */ 
/* 314 */       Method localMethod3 = WebSettings.class.getMethod(
/* 315 */         "setAppCacheMaxSize", new Class[] { Long.TYPE });
/* 316 */       localMethod3.invoke(paramWebSettings, new Object[] { Integer.valueOf(1048576) });
/*     */     }
/*     */     catch (SecurityException localSecurityException) {
/* 319 */       Log.b(c, "ClouldDialog DynamicSelectionSetting Error:" + localSecurityException);
/*     */     } catch (NoSuchMethodException localNoSuchMethodException) {
/*     */     } catch (IllegalArgumentException localIllegalArgumentException) {
/* 322 */       throw localIllegalArgumentException;
/*     */     } catch (IllegalAccessException localIllegalAccessException) {
/* 324 */       Log.b(c, "ClouldDialog DynamicSelectionSetting Error:" + localIllegalAccessException);
/*     */     } catch (InvocationTargetException localInvocationTargetException) {
/* 326 */       Log.b(c, "ClouldDialog DynamicSelectionSetting Error:" + localInvocationTargetException);
/*     */     }
/*     */   }
/*     */ 
/*     */   protected void a() {
/* 331 */     if (this.e.canGoBack()) {
/* 332 */       this.g.setImageResource(this.x);
/* 333 */       this.g.setClickable(true);
/*     */     } else {
/* 335 */       this.g.setImageResource(this.y);
/* 336 */       this.g.setClickable(false);
/*     */     }
/*     */ 
/* 339 */     if (this.e.canGoForward()) {
/* 340 */       this.h.setImageResource(this.z);
/* 341 */       this.h.setClickable(true);
/*     */     } else {
/* 343 */       this.h.setImageResource(this.A);
/* 344 */       this.h.setClickable(false);
/*     */     }
/*     */   }
/*     */ 
/*     */   public static int a(Context paramContext, String paramString1, String paramString2) {
/* 349 */     Resources localResources = paramContext.getResources();
/* 350 */     String str = paramContext.getPackageName();
/* 351 */     int i1 = localResources.getIdentifier(paramString2, paramString1, str);
/* 352 */     if (i1 <= 0)
/* 353 */       throw new RuntimeException("获取资源ID失败:(packageName=" + str + 
/* 354 */         " type=" + paramString1 + " name=" + paramString2);
/* 355 */     return i1;
/*     */   }
/*     */ 
/*     */   static abstract interface a
/*     */   {
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\umeng_sdk.jar
 * Qualified Name:     com.umeng.newxp.view.aN
 * JD-Core Version:    0.6.2
 */